if exists (select 1 from sysobjects where name = 'vw_inactivarbeitsplan' and type = 'V')
begin
   drop view vw_inactivarbeitsplan
   print 'View: vw_inactivarbeitsplan deleted ...'
end
go
create view vw_inactivarbeitsplan
as
     select PlanID 
       from ArbeitsPlan
      where ArbeitsPlan.Status = 2
go
print 'View: vw_inactivarbeitsplan done ...'
go
grant select on vw_inactivarbeitsplan to prsadmins with grant option
go
grant select on vw_inactivarbeitsplan to prsusers
go